<?php
/**
 * Prado Portal.
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006,2007,2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: MySQL.php 391 2010-12-25 13:18:20Z steen.rabol $
 * @package Pradoportal.Pages.Install.MySQL
 *
 */

$drop_table[]	= "DROP TABLE IF EXISTS tblconfig";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblconfig (
id int(11) NOT NULL auto_increment,
name varchar(40) NOT NULL default '0',
value text collate utf8_unicode_ci,
locked int(11) NOT NULL default '0',
culture varchar(25) NOT NULL DEFAULT 'en',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbldownloadfiles";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbldownloadfiles (
id int(11) NOT NULL auto_increment,
grpid int(11) NOT NULL default '0',
filename varchar(45) character set utf8 NOT NULL,
active int(11) NOT NULL default '0',
comment text NOT NULL,
description varchar(45) NOT NULL default '',
dlcount int(11) NOT NULL default '0',
filesize int(11) NOT NULL default '0',
filedate int(11) NOT NULL default '0',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbldownloadportletgrps";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbldownloadportletgrps (
id int(11) NOT NULL auto_increment,
name varchar(45) NOT NULL default '',
description text NOT NULL,
role int(11) NOT NULL default '0',
active int(11) NOT NULL default '1',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblhelp";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblhelp (
id int(11) NOT NULL auto_increment,
pagename varchar(45) NOT NULL,
culture varchar(25) NOT NULL DEFAULT 'en',
content text NOT NULL,
title varchar(45) NOT NULL,
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblhtmlportlet";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblhtmlportlet (
id int(11) NOT NULL default '0',
content text NOT NULL,
css varchar(40) NOT NULL default 'htmlportlet',
culture varchar(25) NOT NULL DEFAULT 'en',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbljscookmenu";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbljscookmenu (
id int(11) NOT NULL,
theme varchar(25) NOT NULL,
menuorientation varchar(3) NOT NULL default 'hbr',
needlogin int(11) NOT NULL default '0',
active int(11) NOT NULL default '1',
name varchar(40) NOT NULL,
sitemenuid int(11) NOT NULL default '0',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbljscookmenuitem";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbljscookmenuitem (
id int(11) NOT NULL auto_increment,
menuid int(11) NOT NULL,
imagepath varchar(128) default NULL,
title varchar(128) NOT NULL,
url varchar(254) default NULL,
target varchar(10) NOT NULL,
isbreak int(11) NOT NULL default '0',
parentid int(11) NOT NULL default '0',
displayorder decimal(7,3) NOT NULL default '0.000',
needlogin int(11) NOT NULL default '0',
showafterlogin int(11) NOT NULL default '1',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbllangstrings";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbllangstrings (
id int(11) NOT NULL auto_increment,
culture varchar(25) NOT NULL,
lkey varchar(128) NOT NULL,
fromvalue text NOT NULL,
tovalue text NOT NULL,
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbllanguages";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbllanguages (
id int(11) NOT NULL auto_increment,
name varchar(45) NOT NULL default '',
country varchar(25) NOT NULL default '',
culture varchar(25) NOT NULL default '',
active int(11) NOT NULL default '0',
displayorder decimal(7,3) NOT NULL default '0.000',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbllog";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbllog (
id int(11) NOT NULL auto_increment,
logtime int(11) NOT NULL default '0',
loglevel varchar(45) NOT NULL default '0',
category varchar(45) NOT NULL default '',
message text NOT NULL,
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbllxlistmenuportlet";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbllxlistmenuportlet (
id int(11) NOT NULL default '0',
pagename varchar(45) NOT NULL default '',
displayname varchar(45) NOT NULL default '',
displayorder decimal(7,3) NOT NULL default '0.000',
active int(11) NOT NULL default '0',
PRIMARY KEY(id,pagename)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblnews";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblnews (
id int(11) NOT NULL auto_increment,
contentid int(11) NOT NULL default '0',
subject varchar(45) NOT NULL default '',
body text NOT NULL,
expire int(11) NOT NULL default '0',
created int(11) NOT NULL default '0',
createdby int(11) NOT NULL default '0',
modified int(11) NOT NULL default '0',
modifiedby int(11) NOT NULL default '0',
isglobal int(11) NOT NULL default '0',
culture varchar(25) NOT NULL DEFAULT 'en',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblpagecontent";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblpagecontent (
id int(11) NOT NULL auto_increment,
pagename varchar(45) NOT NULL default '',
controlname varchar(45) NOT NULL default '',
portlet varchar(45) NOT NULL default '',
displayorder decimal(7,3) NOT NULL default '0.000',
active int(11) NOT NULL default '1',
role int(11) NOT NULL default '1',
needlogin int(11) NOT NULL default '0',
showafterlogin int(11) NOT NULL default '1',
culture varchar(25) NOT NULL DEFAULT 'en',
PRIMARY KEY(id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblpagepath";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblpagepath (
id int(11) NOT NULL auto_increment,
path varchar(254) NOT NULL,
name varchar(65) NOT NULL,
active int(11) NOT NULL default '1',
role int(11) NOT NULL default '0',
PRIMARY KEY(id),
UNIQUE KEY name (name)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblpages";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblpages (
id int(11) NOT NULL auto_increment,
name varchar(45) NOT NULL default '',
role int(11) NOT NULL default '0',
active int(11) NOT NULL default '0',
created int(11) NOT NULL default '0',
modified int(11) NOT NULL default '0',
locked int(11) NOT NULL default '0',
displayname varchar(45) NOT NULL default '',
layoutname varchar(45) NOT NULL default '',
displayorder decimal(7,3) NOT NULL default '0.000',
lockedby int(11) NOT NULL default '0',
lockedtime int(11) NOT NULL default '0',
createdby int(11) NOT NULL default '0',
path varchar(254) default NULL,
fullpath varchar(254) NOT NULL,
metakeywords text,
metadescription text,
PRIMARY KEY(id),
UNIQUE KEY NAMEIDX (name,fullpath)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblpermissions";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblpermissions (
id int(11) NOT NULL auto_increment,
page varchar(254) default NULL,
selector enum('user','role') default NULL,
value int(11) default NULL,
view int(11) NOT NULL default '0',
edit int(11) NOT NULL default '0',
PRIMARY KEY(id),
KEY selector (selector,value,page)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblpollchoices";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblpollchoices (
id int(11) NOT NULL auto_increment,
pollid int(11) NOT NULL default '0',
answer tinytext NOT NULL,
votes int(11) NOT NULL default '0',
displayorder decimal(7,3) NOT NULL default '0.000',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblpolls";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblpolls (
id int(11) NOT NULL auto_increment,
question tinytext NOT NULL,
expire int(11) NOT NULL default '0',
createdby int(11) NOT NULL default '0',
barcolor varchar(7) NOT NULL default '',
contentid int(11) NOT NULL default '0',
active int(11) NOT NULL default '0',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblportlets";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblportlets (
id int(11) NOT NULL auto_increment,
name varchar(45) NOT NULL default '',
displayname varchar(45) NOT NULL default '',
active int(11) NOT NULL default '0',
hasadmin int(11) NOT NULL default '0',
visible int(11) NOT NULL default '1',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblroles";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblroles (
id int(11) NOT NULL auto_increment,
name varchar(45) NOT NULL default '',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblsendemailportlet";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblsendemailportlet (
id int(11) NOT NULL auto_increment,
name varchar(45) NOT NULL default '',
email varchar(45) NOT NULL default '',
active int(11) NOT NULL default '0',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblsimpletext";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblsimpletext (
id int(11) NOT NULL,
content text NOT NULL,
css varchar(40) NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblsitemenu";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblsitemenu (
id int(11) NOT NULL auto_increment,
name varchar(45) NOT NULL,
active int(11) NOT NULL default '1',
role int(11) NOT NULL default '0',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tblsitemenuitem";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblsitemenuitem (
id int(11) NOT NULL auto_increment,
smid int(11) NOT NULL,
title varchar(45) character set utf8 NOT NULL,
page varchar(128) character set utf8 NOT NULL,
img varbinary(128) NOT NULL,
active int(11) NOT NULL,
role int(11) NOT NULL,
parent int(11) NOT NULL default '0',
target varchar(10) character set utf8 NOT NULL,
isbreak int(11) NOT NULL default '0',
displayorder decimal(7,3) NOT NULL default '0.000',
needlogin int(11) NOT NULL default '0',
showafterlogin int(11) NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tbltheme";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbltheme (
id int(11) NOT NULL auto_increment,
name varchar(40) character set utf8 collate utf8_danish_ci NOT NULL,
active int(11) NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tblthemecssclasses";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblthemecssclasses (
id int(11) NOT NULL auto_increment,
themeid int(11) NOT NULL,
name varchar(40) NOT NULL,
active int(11) NOT NULL default '0',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tblthemecssclassesattr";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblthemecssclassesattr (
  id int(11) NOT NULL auto_increment,
  tcid int(11) NOT NULL,
  name varchar(40) NOT NULL,
  attr varchar(128) NOT NULL,
  PRIMARY KEY  (id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tblthemetemplate";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblthemetemplate (
id int(11) NOT NULL auto_increment,
tid int(11) NOT NULL,
name varchar(128) NOT NULL,
content text NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tbltodo";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbltodo (
id int(3) NOT NULL auto_increment,
title varchar(50) character set utf8 default '0',
description text character set utf8,
created int(11) NOT NULL default '0',
deadline int(11) NOT NULL default '0',
priority int(11) NOT NULL default '0',
assignedto int(11) NOT NULL default '0',
createdby int(11) NOT NULL default '0',
status int(11) NOT NULL default '0',
assignedby int(11) NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tbltodohistory";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbltodohistory (
id int(11) NOT NULL auto_increment,
todoid int(11) NOT NULL default '0',
answer text character set utf8 NOT NULL,
created int(11) NOT NULL default '0',
userid int(11) NOT NULL default '0',
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8";

$drop_table[]	= "DROP TABLE IF EXISTS tbluseractivity";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbluseractivity (
id int(11) NOT NULL auto_increment,
userid int(11) NOT NULL,
timestamp int(11) NOT NULL,
ip varchar(32) NOT NULL,
act longblob NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tbluseronline";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tbluseronline (
id int(11) NOT NULL auto_increment,
ip varchar(32) NOT NULL,
timestamp int(11) NOT NULL,
sessionid varchar(32) NOT NULL,
userid int(11) NOT NULL,
page varchar(254) NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[]	= "DROP TABLE IF EXISTS tblusers";
$create_table[]	= "CREATE TABLE IF NOT EXISTS tblusers (
id int(11) NOT NULL auto_increment,
name varchar(128) NOT NULL default '',
full_name varchar(128) default '',
role int(11) NOT NULL default '0',
password varchar(128) NOT NULL default '',
vcode varchar(128) default '',
email varchar(128) NOT NULL default '',
reg_time int(11) NOT NULL default '0',
status int(11) NOT NULL default '0',
sitenews int(11) NOT NULL default '1',
culture varchar(25) NOT NULL default 'en',
PRIMARY KEY(id),
UNIQUE KEY name (name)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[] = "DROP TABLE IF EXISTS tbluseropenids";
$create_table[] = "CREATE TABLE IF NOT EXISTS tbluseropenids (
  id int(11) NOT NULL auto_increment,
  openid_url varchar(255) NOT NULL,
  userid int(11) NOT NULL,
  PRIMARY KEY  (id)
)DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[] = "drop table if exists tblshortstat";
$create_table[] ="CREATE TABLE IF NOT EXISTS tblshortstat (
  id int(11) NOT NULL auto_increment,
  remote_ip varchar(15) NOT NULL default '',
  country varchar(50) NOT NULL default '',
  language varchar(5) NOT NULL default '',
  domain varchar(255) NOT NULL default '',
  referer text,
  resource varchar(255) NOT NULL default '',
  user_agent varchar(255) NOT NULL default '',
  platform varchar(50) NOT NULL default '',
  browser varchar(50) NOT NULL default '',
  version varchar(15) NOT NULL default '',
  dt int(11)  NOT NULL default '0',
  UNIQUE KEY id (id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[] = "drop table if exists tblshortstat_iptocountry";
$create_table[] = "CREATE TABLE IF NOT EXISTS tblshortstat_iptocountry (
  ip_from double NOT NULL default '0',
  ip_to double NOT NULL default '0',
  country_code2 char(2) NOT NULL default '',
  country_code3 char(3) NOT NULL default '',
  country_name varchar(50) NOT NULL default ''
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$drop_table[] = "drop table if exists tblshortstat_searchterms";
$create_table[] = "CREATE TABLE IF NOT EXISTS tblshortstat_searchterms (
  id int(11) NOT NULL auto_increment,
  searchterms varchar(255) NOT NULL default '',
  count int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
?>